﻿using System;
using Wisdom.Core;

namespace Wisdom.Core
{
    /// <summary>
    /// 描述：ID生成配置器 接口
    /// </summary>
    public interface IIdentityGeneratorConfigurator : IConfigSourceConfigurator
    { }

    /// <summary>
    /// 生成配置器
    /// </summary>
    public class IdentityGeneratorConfigurator : TypeSpecifiedConfigSourceConfigurator, IIdentityGeneratorConfigurator
    {
        #region Ctor
        /// <summary>
        /// 实始化 <c>IdentityGeneratorConfigurator</c> 类实例.
        /// </summary>
        /// <param name="context">配置上下文.</param>
        /// <param name="identityGeneratorType">运用程序ID生成器类型.</param>
        public IdentityGeneratorConfigurator(IConfigSourceConfigurator context, Type identityGeneratorType)
            : base(context, identityGeneratorType)
        { }
        #endregion

        #region Protected Methods
        /// <summary>
        /// 配置容器
        /// </summary>
        /// <param name="container">配置容器.</param>
        /// <returns>已配置容器.</returns>
        protected override CodeConfigSource DoConfigure(CodeConfigSource container)
        {
            container.IdentityGenerator = Type;
            return container;
        }
        #endregion
    }
}